package net.thxjj.standard;

import net.thxjj.error.ErrCode;

import java.util.HashMap;

public class ResponseModel{

	private static HashMap<String,Object> model=null;
	
	private ResponseModel() {}
	
	public static HashMap<String, Object> getModel(String msg,String status,Object data){
		model = new HashMap<String, Object>();
		model.put("msg", msg);
		model.put("code", status);
		model.put("data", data);
		return model;
	}
	
	public static HashMap<String, Object> getModel(ResultEnum resultEnum,Object data){
		model = new HashMap<String, Object>();
		model.put("msg", resultEnum.getMsg());
		model.put("code", resultEnum.getCode());
		model.put("data", data);
		return model;
	}

	public static HashMap<String, Object> getModel(ErrCode errcode, Object data){
		model = new HashMap<String, Object>();
		model.put("msg", errcode.getDescription());
		model.put("code", errcode.getCode());
		model.put("data", data);
		return model;
	}

}
